﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Threading.Tasks;
using rmyy.Repository;

namespace rmyy.RepositoryFactory
{
    public partial class DBSession
    {
        public DbContext Db
        {
            get
            {
             return DBContextFactory.CreateDBContext();
            }
        }
        public int SaveChanges()
        {
            return Db.SaveChanges();
        }
        public int ExcuteSql(string sql,SqlParameter[] pars)
        {
            return Db.Database.ExecuteSqlCommand(sql, pars);
        }
        public List<T> ExecuteQuery<T>(string sql,SqlParameter[] pars)
        {
            return Db.Database.SqlQuery<T>(sql, pars).ToList();
        }
    }
}
